package com.kaifamiao.operators;

import java.util.Scanner;

// 三元运算符
// A ? B : C
public class Chicken {
    public static void main(String[] args) {
        // 创建扫描器
        Scanner s = new Scanner( System.in );
        System.out.println( "请输入你的姓名" );
        String name = s.nextLine();
        System.out.printf( "你输入的姓名是%s\n" , name );

        System.out.println( "请输入你的年龄" );
        int age = s.nextInt();
        System.out.printf( "你输入的是%d\n" , age );

        String result = age > 18 ? "成年" : "未成年";

        System.out.println( name + ", " + result );

        // 关闭扫描器
        s.close();
    }
}
